#include "interrupt.h"
#include "c51.h"
#include "common.h"

// 1ms
void interrupt_timer0_1ms_reset(void) {
  i16 max = 0xFC18;
  TH0 = max >> 8;
  TL0 = max & 0b11111111;
}

// @11.0592MHz
void interrupt_timer0_init(void (*reset)(void)) {
  TMOD &= 0xF0;
  TMOD |= 0b00000001;
  reset();
  TF0 = 0; // 清除TF0标志
  TR0 = 1; // 定时器0开始计时
  ET0 = 1;
  EA = 1;
  PT0 = 0;
}
